<template>
  <div class="category" v-if="glist[0]">
    <div class="category-box">
      <div class="title">
        <h3>办公电脑</h3>
      </div>
      <ul>
        <li>
          <router-link :to="'/produc/' + glist[1].id">
            <p>笔记本</p>
            <img
              src=""
              alt=""
            />
          </router-link>
        </li>
        <li>
          <router-link :to="'/produc/' + glist[3].id">
            <p>台式机</p>
            <img
              src=""
              alt=""
            />
          </router-link>
        </li>
        <li>
          <router-link :to="'/produc/' + glist[4].id">
            <p>一体机</p>
            <img
              src=""
              alt=""
            />
          </router-link>
        </li>
        <li>
          <router-link :to="'/produc/' + glist[2].id">
            <p>主机</p>
            <img
              src=""
              alt=""
            />
          </router-link>
        </li>
        <li>
          <router-link :to="'/produc/' + glist[7].id">
            <p>工作站</p>
            <img
              src=""
              alt=""
            />
          </router-link>
        </li>
        <li>
          <router-link :to="'/produc/' + glist[5].id"></router-link>
          <a href="">
            <p>显示器</p>
            <img
              src=""
              alt=""
            />
          </a>
        </li>
      </ul>
    </div>
    <div class="category-box">
      <div class="title">
        <h3>办公外设</h3>
      </div>
      <ul>
        <li>
          <router-link :to="'/produc/' + glist[9].id">
            <p>打印机</p>
            <img
              src=""
              alt=""
            />
          </router-link>
        </li>
        <li>
          <router-link :to="'/produc/' + glist[8].id">
            <p>投影仪</p>
            <img
              src=""
              alt=""
            />
          </router-link>
        </li>
        <li>
          <router-link :to="'/produc/' + glist[6].id">
            <p>平板电脑</p>
            <img
              src=""
              alt=""
            />
          </router-link>
        </li>
        <li>
          <router-link :to="'/produc/' + glist[7].id">
            <p>手机</p>
            <img
              src=""
              alt=""
            />
          </router-link>
        </li>
        <li>
          <router-link :to="'/produc/' + glist[14].id">
            <p>配件</p>
            <img
              src=""
              alt=""
            />
          </router-link>
        </li>
      </ul>
    </div>
    <div class="category-box">
      <div class="title">
        <h3>增值服务</h3>
      </div>
      <ul>
        <li>
          <router-link :to="'/produc/' + glist[16].id">
            <p>安装升级</p>
          </router-link>
        </li>
        <li>
          <router-link :to="'/produc/' + glist[18].id">
            <p>维护保养</p>
          </router-link>
        </li>
        <li>
          <router-link :to="'/produc/' + glist[17].id">
            <p>无忧服务</p>
          </router-link>
        </li>
        <li>
          <router-link :to="'/produc/' + glist[19].id">
            <p>驻场服务</p>
          </router-link>
        </li>
      </ul>
    </div>
    <div class="category-box">
      <div class="title">
        <h3>增值服务</h3>
      </div>
      <ul>
        <li>
          <a href="">
            <p>网络部署</p>
          </a>
        </li>
        <li>
          <a href="">
            <p>office</p>
          </a>
        </li>
      </ul>
    </div>
  </div>
</template>

<script>
import axios from "axios";
export default {
  data() {
    return {
      glist: [],
    };
  },
  created() {
    let url =
      "https://m.edianyun.com/newsCategory/queryAllProductCatagloyForNew?time=1631066594275&code=b3a44e4284e02559a809427582610fd0";
    axios.get(url).then((res) => {
      console.log(res);
      this.glist = res.data.data.Catagroy;
    //   console.log(this.glist[1].id);
    });
  },
};
</script>

<style lang="scss" scoped>
.category {
  width: 100%;
  // height: 200px;
  position: absolute;
  left: 0;
  right: 0;
  top: 20px;
  bottom: 20px;
  box-sizing: padding-box;
  background: #f4f5f7;
  color: #333;
  overflow: auto;
  margin-top: 52px;
  // padding-bottom: .45rem;
}
.category-box {
  width: 100%;
  height: auto;
  margin-bottom: 10px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  .title {
    width: 100%;
    height: 60px;
    color: #37a3ff;
    padding-left: 20px;
    background-color: #fff;
    border-bottom: 2px solid #ccc;
    display: flex;
    justify-content: flex-start;
    align-items: center;
    h3 {
      font-size: 14px;
    }
  }
  ul {
    width: 100%;
    display: flex;
    overflow: hidden;
    box-sizing: border-box;
    background-color: #fff;
    flex-wrap: wrap;
    li {
      width: 25%;
      height: 80px;
      display: flex;
      flex-direction: column;
      justify-content: center;
      align-items: center;
      box-sizing: border-box;
      border-right: 2px solid #f4f5f7;
      border-bottom: 2px solid #f4f5f7;
      background-color: #fff;
      font-size: 14px;
      img {
        width: 50px;
        height: 32px;
        display: flex;
        justify-content: center;
        align-items: center;
      }
      p{
        text-align: center;
        font-size: 12px;
        // padding-left: 5px;
      }
    }
  }
}
</style>